<template>
	<view>

		<radio-group @change="change">
			<radio v-for="(item,index) in languages" :value="item.value" :checked="item.checked">{{item.label}}</radio>
		</radio-group>

		<block>
			<view>当前语言类型：{{$t('language')}}</view>
			<view>
				动态赋值演示：
				<input v-model="inputValue" placeholder="请输入替换内容" />
				<button @click="showMessage">显示动态信息</button>
			</view>
		</block>


	</view>
</template>

<script>
	import {
		setlanguage,
		toast
	} from '../../../common/tools';
	export default {
		data() {
			return {
				value: 'zn',
				inputValue: '',
				languages: [{
						label: '简体中午',
						value: 'zn',
						checked: true
					},
					{
						label: '繁体中午',
						value: 'tw',
						checked: false
					}, {
						label: '英文',
						value: 'en',
						checked: false
					}
				]

			};
		},
		methods: {
			change(value) {
				this.value = value.detail.value
				setlanguage(value.detail.value)
			},
			showMessage() {
				toast(this.$t('tips', {
					message: this.inputValue
				}))
			}
		}
	}
</script>

<style lang="scss">
	page {
		padding: 25rpx 45rpx;
	}
</style>